#! /usr/bin/python3
# _*_ conding:utf-8 _*_
"""
    继承和多态
"""


class Animal(object):
    name = 'hua'

    def __init__(self):
        self.x = None

    def run(self):
        print('animal is running>>>>')


class Dog(Animal):

    def run(self):
        print('Dog is running>>>>>>')


class Cat(Animal):

    def run(self):
        print('Cat is running>>>>>>>')


class People(object):

    def run(self):
        print('People is running>>>>>>>')


def twice(Animal):
    Animal.run()
    Animal.run()


def main():
    twice(Animal())
    twice(Dog())
    twice(Cat())
    # 和animal无关的People类也可以用twice函数
    twice(People())
    print(dir(object))
    print(dir(Animal))
    a = Animal()
    print(dir(a))


if __name__ == '__main__':
    main()
